package com.yuuko.yuukoapi.model.system

import com.yuuko.yuukoapi.common.utils.UUIDGenerator
import com.yuuko.yuukoapi.model.base.BaseEntity
import org.babyfish.jimmer.sql.Column
import org.babyfish.jimmer.sql.Entity
import org.babyfish.jimmer.sql.GeneratedValue
import org.babyfish.jimmer.sql.Id
import org.babyfish.jimmer.sql.IdView
import org.babyfish.jimmer.sql.JoinColumn
import org.babyfish.jimmer.sql.ManyToOne
import org.babyfish.jimmer.sql.OneToMany
import org.babyfish.jimmer.sql.Table

/**
 * <p>
 *  dept

 * </p>
 *
 * @author yuuko
 * @date 2025-06-21
 */
@Entity
@Table(name = "depts")
interface Depts : BaseEntity {

    /**
     *  id

     */
    @Id
    @GeneratedValue(generatorType = UUIDGenerator::class)
    val id: String

    /**
     *  parent_id

     */
    @IdView("parent")
    val parentId: String?

    /**
     *  name

     */
    val name: String

    /**
     *  remark

     */
    val remark: String?

    @ManyToOne
    @JoinColumn(name = "parent_id")
    val parent: Depts?

    @OneToMany(mappedBy = "parent")
    val children: List<Depts>
}